﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using repliback4.Net.Protocol.Messages.Attributes;

namespace repliback4.Misc {
    public static class TypeExtension {

        public static String GetReplibackTagName ( this Type type ) {
            RequestTag[] _tag = ( RequestTag[] ) type.GetCustomAttributes( typeof( RequestTag ), false );
            if ( _tag.Length != 1 ) {
                throw new Exception( "you are trying to register invalid type" );
            }

            return _tag[0].QualifiedName;
        }
    }

}
